<template>
  <div class="sidebar">
    <div class="logo">
      <h2>系统名称</h2>
    </div>
    <nav class="menu">
      <router-link 
        v-for="item in menuItems" 
        :key="item.path"
        :to="item.path"
        class="menu-item"
        exact
  :class="{ active: isActive(item.path) }"
      >
        <span>{{ item.name }}</span>
      </router-link>
    </nav>
  </div>
</template>

<script setup>
import { useRoute } from 'vue-router'
const route = useRoute()
const isActive = (path) => {
  if (route.path === '/' && path === '/test') {
    return true
  }
  return route.path === path
}
const menuItems = [
   { name: '监测指标统计',path:'/monitoring-indicators'},
  { name: '数据汇聚',path:'/data-aggregation'},
  { name: '区域化展示',path:'/regional-display'},
  // { name: '报警事件管理',path:'/alarm-event-management'},

  { name: '风险管理与分析',path:'/risk-analysis'},
  // { name: '重点风险提示',path:'/focus'},
  { name: '预警信息推送',path:'/risk-warning-push'},
  { name: '智能风险评估',path:'/intelligent-risk-assessment'},

  { name: '企业信息汇总',path:'/summary-information'},
  { name: '巡查功能',path:'/patrol'},
  { name: '检索功能',path:'/search'},
  { name: '一屏汇聚展示',path:'/screen-display'},

  { name: '联网与设备分析',path:'/equipment'},
  { name: '应用情况分析',path:'/application'},
  { name: '数据质量分析',path:'/data-quality'},
  { name: '定期专题报告',path:'/report'},

  { name: '用户权限管理',path:'/user-permission'},
  { name: '系统配置管理',path:'/system-manage'},
  { name: '数据管理',path:'/data-manage'},
  { name: '系统监控与维护',path:'/monitoring'},

  
  { name: '测试', path: '/test' }
]
</script>

<style scoped>
.sidebar {
  width: 200px;
  height: 100vh;
  background: #001529;
  color: white;
}

.logo {
  padding: 20px;
  text-align: center;
  border-bottom: 1px solid #333;
}

.menu {
  padding: 20px 0;
}

.menu-item {
  display: block;
  padding: 12px 24px;
  color: rgba(255, 255, 255, 0.65);
  text-decoration: none;
  transition: all 0.3s;
}

.menu-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.menu-item.active {
  background: #1890ff;
  color: white;
}
</style>